package demo.lifecycle;

import org.springframework.beans.factory.DisposableBean;

/**
 * Created with IntelliJ IDEA.
 * User: neerajY
 * Date: 8/25/13
 * Time: 8:42 PM
 * To change this template use File | Settings | File Templates.
 */
public class AccountService {
    private float balance;

    public AccountService(){
        System.out.println("<< *** Bean instance created   >>");
    }

    public void setBalance(float balance){
        this.balance = balance;
        System.out.println("<<**  Bean populated  **>>");
    }

    public float getBalance(){
        return this.balance;
    }

    /**
     * init method called at the time of initialization
     */
    public void init(){
        System.out.println("<<** Bean initialized **>>");
    }

    /**
     * destroy method
     */
    public void destroy(){
        System.out.println("<<**  Bean about to destroy   **>>");
    }

    public float calculateInterest(){
        return balance*0.05f;
    }
}
